import request from '@/utils/request';

// 查询组织列表
// export function listOrganization(query : any) {
// 	return request({
// 		url: '/api/system/organization/list',
// 		method: 'get',
// 		params: query
// 	})
// }
export function listOrganization(query: any) {
	return request({
		url: '/api/organization/list',
		method: 'get',
		params: query,
	});
}

// 查询组织详细
// export function getOrganization(organizationId: number) {
// 	return request({
// 		url: '/api/system/organization/' + organizationId,
// 		method: 'get',
// 	});
// }

// 查询组织下拉树结构
// export function treeselect() {
// 	return request({
// 		url: '/api/system/organization/organizationTree',
// 		method: 'get',
// 	});
// }

export function treeselect() {
	return request({
		url: '/api/organization/list',
		method: 'get',
	});
}

// 根据角色ID查询组织树结构
// export function roleOrganizationTreeselect(roleId: number) {
// 	return request({
// 		url: '/api/system/organization/roleOrganizationTreeSelect/' + roleId,
// 		method: 'get',
// 	});
// }
export function roleOrganizationTreeselect(roleId: number) {
	return request({
		url: '/api/organization/roleOrganizationTreeSelect/' + roleId,
		method: 'get',
	});
}

// 新增组织
// export function addOrganization(data: any) {
// 	return request({
// 		url: '/api/system/organization',
// 		method: 'post',
// 		data: data,
// 	});
// }
export function addOrganization(data: any) {
	return request({
		url: '/api/organization/list',
		method: 'post',
		data: data,
	});
}

// 修改组织
// export function updateOrganization(data: any) {
// 	return request({
// 		url: '/api/system/organization',
// 		method: 'put',
// 		data: data,
// 	});
// }
export function updateOrganization(filter: any, data: any) {
	return request({
		url: `/organization/list/${filter}`,
		method: 'put',
		data: data,
	});
}

// 删除组织
// export function delOrganization(organizationId: number) {
// 	return request({
// 		url: '/api/system/organization/' + organizationId,
// 		method: 'delete',
// 	});
// }

export function delOrganization(organizationId: number) {
	return request({
		url: '/api/organization/list/' + organizationId,
		method: 'delete',
	});
}
